package PJ;

public class Stock {
	String name;
	int number;//序号
	double price;
	int hold=0;//持有量
	double increase;
	public boolean state=false;
	Stock(String name,int number,double price){
		this.name=name;
		this.number=number;
		this.price=price;
	}
	public  String getName(){
		return name;	
	};
	public  int getNumber() {
		return number;
	}
	public  int getHold() {
		return hold;
	}
	public  void setHold(int i) {
		this.hold=i;
	}
	public  double getPrice() {
		return price;
	}
	public  double getIncrease() {
		return increase;
	}
	public void run() {
		increase=(Math.random()-0.5)*0.2;
		increase=Double.parseDouble(String.format("%.2f",increase));
		this.price=price*(1+increase);
		this.price=Double.parseDouble(String.format("%.2f",price));
	}
	public static Stock[] stocksystem = new Stock[10];
	static{
		stocksystem[0]=new Stock("zhonghaifazhan",1,2.0);
		stocksystem[1]=new Stock("dongfengqiche",2,1.5);
		stocksystem[2]=new Stock("jinangangtie",3,1.8);
		stocksystem[3]=new Stock("zhongguoguomao",4,2.5);
		stocksystem[4]=new Stock("baoganggufen",5,2.7);
		stocksystem[5]=new Stock("huanengguoji",6,2.9);
		stocksystem[6]=new Stock("baoganggufen",7,3.3);
		stocksystem[7]=new Stock("shanghaidianli",8,3.5);
		stocksystem[8]=new Stock("zhongyuangaosu",9,3.2);
		stocksystem[9]=new Stock("shanghaidianli",10,1.7);	
	}
}